package com.todod.base.module.base.controller.admin.dto;

/**
 * zhiHui
 */
public class ResultData {
    private static final String OK = "ok";
    private static final String ERROR = "error";
    private  static  final String fail = "运维标题存在，请重新输入";
    public static final int OK_CODE = 0; // 成功
    public static final int ERROR_CODE = 50000; // 系统异常
    public static final int PARAM_ERROR_CODE = 50002; // 参数错误
    public static final int METHOD_NOT_SUPPORTED = 50003; // 请求方式不正确
    public static final int REQUEST_INTERFACE_ERROE_CODE = 50004; // 接口请求异常

    public static final int ESTIMATE_ERROR_CODE = 50100; // 自定义异常

    public static final int USER_NOT_LOGIN = 50101; // 用户未登录
    public static final int USER_LOGIN_EXPIRED = 50102; // 用户登陆超时
    public static final int USER_LOGIN_AcountError = 50103; // 用户名或密码错误
    public static final int USER_LOGIN_StateError = 50104; // 用户状态禁用
    public static final int INTERFACE_ERROR = 50105; // 接口请求异常
    public static final int SINGLE_LOGIN_ERROR = 50106; // 单用户登陆异常
    public static final int USER_UPLOAD_PASSWORD = 50107; // 强制用户修改密码
    /**
     * 响应结果
     */
    private int code;

    /**
     * 响应消息
     */
    private String msg;
    /**
     * 响应消息
     */
    private Object data;

    public ResultData() {
    }

    public ResultData(int code, String msg) {
        super();
        this.code = code;
        this.msg = msg;
    }

    public ResultData(int code, String msg, Object data) {
        super();
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static ResultData fail(String message) {
        return new ResultData(PARAM_ERROR_CODE, fail);
    }


    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public static ResultData success() {
        return new ResultData(OK_CODE, OK);
    }

    public static ResultData success(String msg) {
        return new ResultData(OK_CODE, msg);
    }

    public static ResultData success(String msg, Object data) {
        return new ResultData(OK_CODE, msg, data);
    }

    public static ResultData error() {
        return new ResultData(ERROR_CODE, ERROR);
    }

    public static ResultData error(String msg) {
        return new ResultData(ERROR_CODE, msg);
    }

    public static ResultData error(String msg, Object data) {
        return new ResultData(ERROR_CODE, msg, data);
    }

    public static ResultData error(int code, String msg) {
        return new ResultData(code, msg);
    }

    public static ResultData error(int code, String msg, Object data) {
        return new ResultData(code, msg, data);
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
